package com.mysnail.boy.controller;

import org.apache.log4j.Logger;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created By XJL On 2017/11/10
 */
@RestController
public class HolleController {
    private static Logger logger = Logger.getLogger(HolleController.class);

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String say(){
        return "Hello SpringBoot!";
    }

    @RequestMapping("/hello")
    public String greeting(@RequestParam(value = "name",required = false,defaultValue = "Hello")String name, Model model){
        logger.info("Hello!");
        model.addAttribute("name",name);

        return "hello";
    }
}
